package com.lagou.edu.message.mq.listener;

import com.lagou.edu.common.constant.MQConstant;
import com.lagou.edu.common.result.ResultCode;
import com.lagou.edu.common.util.ValidateUtils;
import com.lagou.edu.message.api.dto.Message;
import com.lagou.edu.message.server.PushServer;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@RocketMQMessageListener(topic = MQConstant.Topic.LESSON_RELEASE_SEND_MESSAGE,consumerGroup = "${rocketmq.producer.group}" + "_" + MQConstant.Topic.LESSON_RELEASE_SEND_MESSAGE)
public class CourseUpNoticeListener implements RocketMQListener<String>
{

    public void onMessage(String courseName) {
        Message message = new Message();
        message.setUserId(1111);
        message.setContent(courseName+"课程新上线，欢迎试学");
        PushServer.pushServer.push(message);
    }
}
